🎯 Задание: Найти 3 самых популярных товара по количеству покупок (не по числу пользователей, а по общему количеству упоминаний).
✅ Ожидаемый результат:
[('banana', 4), ('apple', 4), ('orange', 2)]
💡 Решение:
from collections import Counter
# Собираем все товары в один список all_items = [] for order in orders: all_items.extend(order["items"])
# Считаем количество каждого товара item_counts = Counter(all_items)
# Получаем топ-3 самых популярных top_3 = item_counts.most_common(3)
print(top_3)
📌 Что тренирует задача:
• Работа со словарями и списками • Использование Counter из модуля collections • Умение работать с вложенными структурами • Сортировка по частоте с помощью most_common()
🎯 Задание: Найти 3 самых популярных товара по количеству покупок (не по числу пользователей, а по общему количеству упоминаний).
✅ Ожидаемый результат:
[('banana', 4), ('apple', 4), ('orange', 2)]
💡 Решение:
from collections import Counter
# Собираем все товары в один список all_items = [] for order in orders: all_items.extend(order["items"])
# Считаем количество каждого товара item_counts = Counter(all_items)
# Получаем топ-3 самых популярных top_3 = item_counts.most_common(3)
print(top_3)
📌 Что тренирует задача:
• Работа со словарями и списками • Использование Counter из модуля collections • Умение работать с вложенными структурами • Сортировка по частоте с помощью most_common()
Like a stock, you can buy and hold Bitcoin as an investment. You can even now do so in special retirement accounts called Bitcoin IRAs. No matter where you choose to hold your Bitcoin, people’s philosophies on how to invest it vary: Some buy and hold long term, some buy and aim to sell after a price rally, and others bet on its price decreasing. Bitcoin’s price over time has experienced big price swings, going as low as $5,165 and as high as $28,990 in 2020 alone. “I think in some places, people might be using Bitcoin to pay for things, but the truth is that it’s an asset that looks like it’s going to be increasing in value relatively quickly for some time,” Marquez says. “So why would you sell something that’s going to be worth so much more next year than it is today? The majority of people that hold it are long-term investors.”
NEWS: Telegram supports Facetime video calls NOW!
Secure video calling is in high demand. As an alternative to Zoom, many people are using end-to-end encrypted apps such as WhatsApp, FaceTime or Signal to speak to friends and family face-to-face since coronavirus lockdowns started to take place across the world. There’s another option—secure communications app Telegram just added video calling to its feature set, available on both iOS and Android. The new feature is also super secure—like Signal and WhatsApp and unlike Zoom (yet), video calls will be end-to-end encrypted.